#include <stdio.h>

int main(int argc, char const *argv[])
{
     FILE *file= fopen("love.txt", "a+"); //r w a  r+  w+  a+
     if (file == NULL)  
     {
         printf("Error opening file!\n");
     }
     else
     {
         printf("File opened successfully!\n");
     }
      
     char boy[20];
     char girl[20];
     int age;

     while(fscanf(file, "%s %s %d", boy,girl,&age )!= EOF)
     {
         printf("  %s 遇上了 %s ，那年他%d岁\n",boy,girl,age);
     }  
     
     if(fclose(file)==0)
     {
         printf("File closed successfully!\n");
     }else
     {
        printf("File opened failed!\n");
     }
     

    return 0;
}
